#include <iostream>

using namespace std;

int main()
{
    int n;
    while (cin >> n)
    {
        if (n == 0)
        {
            break;
        }
        int count = 0;
        while (n)
        {
            count++;
            if (n % 2)
            {
                n = n / 2 + 1;
            }
            else
                n /= 2;
        }
        printf("%d\n", count);
    }
    return 0;
}